﻿using System.ComponentModel;

namespace HeritageAcademy.Models.ViewModels
{
    public class ViewModelBase<T> : INotifyPropertyChanged
    {
        private T _model;

        protected ViewModelBase(T model)
        {
            Model = model;
        }

        public T Model
        {
            get { return _model; }
            private set
            {
                _model = value;
                RaisePropertyChanged("Model");
            }
        }

        public event PropertyChangedEventHandler PropertyChanged;
        protected void RaisePropertyChanged(string name)
        {
            if (PropertyChanged != null)
                PropertyChanged(this, new PropertyChangedEventArgs(name));
        }
    }

    public class ViewModelBase : INotifyPropertyChanged
    {
        public event PropertyChangedEventHandler PropertyChanged;
        protected void RaisePropertyChanged(string name)
        {
            if (PropertyChanged != null)
                PropertyChanged(this, new PropertyChangedEventArgs(name));
        }
    }
}